package com.metaera.app.ui.adapters;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.metaera.app.R;
import com.metaera.app.data.model.FeedbackResponse;

import androidx.annotation.NonNull;

public class FeedbackHistoryAdapter extends BaseQuickAdapter<FeedbackResponse, BaseViewHolder> {

    public FeedbackHistoryAdapter() {
        super(R.layout.item_history_feedback);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, FeedbackResponse item) {
        holder.setText(R.id.tv_date, item.getAdd_time())
                .setText(R.id.tv_content, item.getContent());

        TextView tvFeedbackType = holder.getView(R.id.tv_feedback_type);
        String[] feedbackTypes = tvFeedbackType.getResources().getStringArray(R.array.feedback_types);
        if (item.getType() < feedbackTypes.length) {
            tvFeedbackType.setText(feedbackTypes[item.getType() - 1]);
        }
    }

}
